<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<title>产品类别列表</title>
<link rel="stylesheet" type="text/css" href="${base}/css/admin/global.css" />
<link rel="stylesheet" type="text/css" href="${base}/css/admin/mainframe.css" />
<script src="${base}/js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
	
//全选 
function checkAll(isChecked){
	if(isChecked){
		$("input[name='checkOne']").attr("checked",true);
	}else{
		$("input[name='checkOne']").attr("checked",false);
	}
	
}
	
function getType(){
	var act = new Array();
	$("input[name='checkOne']:checked").each(function(){
		act.push(this.value);
	});
	return act;
}

function batchDel(){
	var type = getType();
	if(type.length==0){
		_alert("请选择要删除的产品分类！");
		return;
	}
	if(confirm("确认删除吗？")){
		var url = "${base}/admin/prod/type/batchDel.do";
		$.post(url,{ids:type.join(",")},function(data){
			if(data>0){
				window.location.reload();
			}else{
				alert("删除失败!");
			}
		},"text")
	}
}
	
	
function deleteOne(id){
	if(confirm("确认删除吗？")){
		var url = "${base}/admin/prod/type/del.do";
		$.post(url,{id:id},function(data){
			if(data=="1" || data==1){
				window.location.reload();
			}else{
				alert("删除失败!");
			}
		},"text")
	}
}
	
</script>
</head>
<body>
<DIV class="mbody">
    <div class="tagLine"><a href="${base}/admin/main.do">桌面</a> » 产品管理 » 产品类别列表</div>
        <div class="tabledata">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" class="listTable">
	        <tr class="top">
		    	<td class="first"><input type="checkbox" name="_checkBox" id="_checkBox" onclick="checkAll(this.checked)"/></td>
		    	<td colspan="2">
	                <span class="sysBtn"><a href="javascript:batchDel()" ><b class="icon icon_del"></b>删除</a></span>
		    	</td>
		    </tr>
		    <tr class="top">
		    	<th class="first"></th>
		        <th>产品类别名称</th>
		        <th>操作</th></tr>
		    </tr>
			<#if lstProdType?? && lstProdType?size != 0>
				<#list lstProdType as bean>
		       	<tr class="data" id="tr_${bean.typeId}">
		       		<td class="first"><input type="checkbox" name="checkOne" value="${bean.typeId}"/></td>
		       		<td>${bean.typeName}</td>
					<td>
			            <span class="sysBtn"><a href="${base}/admin/prod/type/toEdit.do?id=${bean.typeId}" target="_self">编辑</a></span>
			            <span class="sysBtn"><a href="javascript:deleteOne('${bean.typeId}');" target="_self">删除</a></span>
			        </td>
		        </tr>
				</#list>
			<#else>
				<tr class="data"><td colspan="4">还没有产品类别信息</td></tr>
			</#if>
        </table>
        </div>
</DIV>
</body>
</html>
